package com.trkj.dao.lzs;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.trkj.pojo.Position;

public interface PositionDAO extends JpaRepository<Position, Long>{
	@Query("select p from Position p inner join p.organization o where o.organiId =?1") 
	public List<Position> findOneByOgn(Long organiId);
	
	
	/*select p.positionId from Position p where p.organization is NULL or p.organization.organiId=?1*/
	/*@Query("select p from Position p left join p.organization o where ?1 not in (o.organiId)")*/ 
	@Query("select o from Position o where o.positionId not in (select p.positionId from Position p inner join p.organization o where o.organiId =?1)")
	public List<Position> findOneByOgnReverse(Long organiId);

}
